<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        html,
        body{
            background-color: rgb(0, 204, 255);
            overflow: hidden;
        }
        .section{
            width: 500px;
            height: 100vh;
            background-color: rgb(255, 0, 0);
            position: absolute;
            top: 0;
            right: 0;
            transition: 1s ease;
        }
        .active{
            right: -500px;
        }
    </style>
</head>
<body>
    <div id="app">
        <button v-on:click='btn'>点击</button>
        <div class="section " v-bind:class='classObj'></div>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <script>
        let vm = new Vue({
            el:'#app',
            data:{
                classObj:{active:false}
            },
            methods: {
                btn(){
                    this.classObj.active=!this.classObj.active
                }
            }
        })
    </script>
</body>
</html>